<%@page import="org.joda.time.DateTime"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>

<script type="text/javascript" src="/js/jquery-1.6.2.min.js"></script> 

<script type="text/javascript">
    function sign(button,type) {
        $.get('/raid/1/sign', "type="+type,function(data) {
        	button.className="selected";
        	})
    }
</script>

<ol id="raid-cal" class="calendar">
  <li class="calendar-head">Monday</li>
  <li class="calendar-head">Tuesday</li>
  <li class="calendar-head">Wednesday</li>
  <li class="calendar-head">Thursday</li>
  <li class="calendar-head">Friday</li>
  <li class="calendar-head">Saturday</li>
  <li class="calendar-head">Sunday</li>
  <c:forEach var="d" items="${cal.iterator()}">
    <li <c:if test="${d.isToday()}" >class="calendar-today"</c:if>>
        <c:choose>
            <c:when test="${d.hasRaid()}">
                <joda:format value="${d.date}" pattern="d" />
                <div id="raid-${d.raid.id}-buttons" class="button-group">
                    <button onclick="javascript:sign(this,'t')">T</button>
                    <button onclick="javascript:sign(this,'h')">H</button>
                    <button onclick="javascript:sign(this,'d')">D</button>
                    <button onclick="javascript:sign(this,'u')">U</button>
                </div>
                <a href="/raid/${d.raid.id}"> </a>
            </c:when>
            <c:otherwise>
                <joda:format value="${d.date}" pattern="d" />
            </c:otherwise>
        </c:choose>
    </li>
  </c:forEach>
</ol>
